//
//  KABasic.swift
//  kano
//
//  Created by Frank on 2024/8/27.
//

import KakaJSON

//MARK: request Param
struct KAApplyRowElement: Convertible, Codable {
    //fieldId
    var fieldIdentifier: Int = 0
    //fieldCode
    var fieldingCode: String = ""
    //meaning
    var definitionMeaning: String = ""
    
    //sortId
    var sortingOrder: Int = 0
    //pageId
    var paginationId: Int = 0
}
struct KAApplyPageElement: Convertible, Codable {
    //taskId
    var currentBusinessArgument: String = ""
    var componentElements : [KAApplyRowElement]?
    
    //pageId
    var paginationId: String = ""
    //backendUrl
    var backendDestinationURL: String = ""
    //pageName
    var pageTitle: String = ""
    //uploadUrl
    var uploadResourceURL: String = ""
    //pageSortId
    var pageSortingOrder: String = ""
    //pageUrl
    var pageAccessURL: String = ""
}

struct KAApplyElement: Convertible, Codable {
    //pageElements 3个页面的信息
    var brokerageFee : [KAApplyPageElement]?
    //creditResult 数据回显用的信息
    var inviteRewardResponse: String = ""
    
    //token
    var withdrawalBankAbbreviation: String = ""
    //redirectUrl
    var feedbackCommentList: String = ""
    
    //fkUserGid
    var relatedUserIdentifier: String = ""
    //活体识别次数
    var livecreditresult: String = ""
    //是否灰度用户，进行活体识别
    var liveCreditUser: Bool = false
    //livenessId
    var authlivenessindicator: String = ""
}

struct KAApply: Convertible, Codable {
    //basicsAuth 审核中: 1  审核失败:-1  审核成功: 2
    var creditCondition: Int = 0
    //refuseFlag 小额被拒绝: 1、3   审核中: 8、10
    var creditTiming: String = ""
    //installRefuseFlag 大额被拒状态:1
    var installationRejectionFlag: String = ""
    //creditElement 所有数据都在这个集合里
    var isExtendedSubCreditEligible: KAApplyElement?
    //1是白名单
    var authorizedEntityList: String = ""
    //risk_auth_param //1表示有联系人页面，其他值或者为空表示跳过联系人页面
    var hazardApprovalSettings: String = ""
    //isHuidus 暂时未用到
    var liquidationStatus: Int = 0
    var authPageTip: String = ""
    
    //creditLine 小额授信额度
    var loanInterestPercentage : Double = -0.1
    //小额可借额度
    var currentammo: Double = 0.0
    //小额最低可借金额
    var minimumThreshold: Double = 0.0
    
    //大额用户总额度
    var secondaryCreditLimit : Double = -0.1
    //大额可借额度
    var bankingInstitutionIdentifier: Double = 0.0
    //大额最小可借金额
    var subLowestLimit: Double = 0.0
    // isSubLogic 1:大额
    var subLogicIndicator: Int = 0
}


//MARK: UI show data
struct KAApplyRowInfo: Convertible, Codable {
    //parentId
    var parentIdentifier: Int = 0
    //value
    var monetaryValue: Int = 0
    //label
    var labelDescription: String = ""
    //report
    var reportingStructure: String = ""
}

struct KAApplyMobile: Convertible, Codable {
    //name
    var voucherImageURL: String = ""
    //phone
    var realNameBindingCard: String = ""
}

//提交和回显联系人contact数据模型
struct KAContact: Convertible, Codable {
    //relation1
    var relationFirst: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo1
    var phoneContactFirst: KAApplyMobile = KAApplyMobile()

    //relation2
    var relationSecond: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo2
    var phoneContactSecond: KAApplyMobile = KAApplyMobile()

    //relation3
    var relationThird: KAApplyRowInfo = KAApplyRowInfo(parentIdentifier: 0, monetaryValue: 1158953, labelDescription: "Friend", reportingStructure: "Friend")
//    var relationThird: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo3
    var phoneContactThird: KAApplyMobile = KAApplyMobile()
}
//提交和回显基本数据personinfo数据模型
struct KAPerson: Convertible, Codable {
    
    var whatsapp: String = ""
    var facebook: String = ""
    
    //alternateNum
    var alternativeContactNumber: String = ""
    //email
    var applicationTitle: String = ""
    //companyTel
    var companyTelephone: String = ""
    //jobBeginTime
    var jobStartDate: String = ""
    //homeAddressDetail
    var detailedHomeAddress: String = ""
    //educationLevel
    var backgroundTone: KAApplyRowInfo = KAApplyRowInfo()
    //jobStatus
    var employmentStatus : KAApplyRowInfo = KAApplyRowInfo()
    //job
    var jobPosition : KAApplyRowInfo = KAApplyRowInfo()
    //monthSalary
    var monthlyIncome : KAApplyRowInfo = KAApplyRowInfo()
    //marriageStatus
    var uploadTimestamp : KAApplyRowInfo = KAApplyRowInfo()
    //residentialType
    var dwellingCategory : KAApplyRowInfo = KAApplyRowInfo()
    //homeAddressState
    var residentialLocationState : KAApplyRowInfo = KAApplyRowInfo()
    //homeAddressRegion
    var residentialLocationDistrict : KAApplyRowInfo = KAApplyRowInfo()
    //payDay
    var paymentDay : KAApplyRowInfo = KAApplyRowInfo()
}
//提交和回显基本数据idcard数据模型
struct KABasic: Convertible, Codable {
    //firstName
    var firstNameUser: String = ""
    //middleName
    var middleNameUser: String = ""
    //surName
    var lastNameUser: String = ""
    //birthday
    var overdueam: String = ""
    //gender
    var startTimestamp: String = ""
    //bvnInputed
    var bankVerificationNumberInput: String = ""
}

struct KAApplySubmit: Convertible, Codable {
    //idcard
    var identityDocumentNumber : KABasic?
    //personinfo
    var personalInformation : KAPerson?
    //contact
    var contactMethod : KAContact?
}
